#ifndef __RENDER_TYPES_H__
#define __RENDER_TYPES_H__

#include "DXUT.h"
#include <xnamath.h>
#include <string>
#include <vector>

struct SimpleVertex
{
	XMFLOAT2	Tex;
	XMFLOAT2	LightmapTex;
	XMFLOAT4	Pos;
};

struct ConstantBuffer
{
	XMMATRIX	worldView, proj;
	XMFLOAT4	lightDir;
	XMFLOAT4	lightColour;
};

const int MAX_INDEXES = 2048;

enum WorldSurfaceType
{
	Surface_Invalid,
	Surface_TriangleList,
	Surface_Patch,
};

const int TEXTURE_INVALID = -2;
const int LIGHTMAP_INVALID = -2;

// pulled out my arse
const int MAX_PATCH_VERTS = 64;
const int MAX_PATCH_INDEXES = MAX_PATCH_VERTS * 2;

struct WorldSurface
{
	int			type;
	int			numIndexes;
	int			indexes[MAX_INDEXES];	
	std::string	texture;
	int			lightmap;
	int			firstVertex;
	int			firstIndex;
};

enum BlendFuncParams
{
	Blend_None,
	Blend_One,
	Blend_Zero,
	Blend_DstColour,
	Blend_SrcAlpha,
	Blend_OneMinusSrcAlpha,
};

struct ShaderStage
{
	ShaderStage()
		: texture("default")
		, srcParam(Blend_None)
		, dstParam(Blend_None)
	{
	}

	std::string					texture;
	BlendFuncParams				srcParam;
	BlendFuncParams				dstParam;
};

struct Shader
{
	std::string					name;
	std::vector<ShaderStage>	stages;
};

struct RenderShaderStage
{
	RenderShaderStage()
		: texture(NULL)
		, srcParam(Blend_None)
		, dstParam(Blend_None)
	{
	}

	ID3D11ShaderResourceView*		texture;
	BlendFuncParams					srcParam;
	BlendFuncParams					dstParam;
};

struct RenderShader
{
	std::string						name;
	std::vector<RenderShaderStage>	stages;
};

struct ShaderSurfaces
{
	ShaderSurfaces()
		: firstIndex(0)
		, numIndexes(0)
		, shader("default")
		, lightmap(-1)
	{
	}

	int								firstIndex;
	int								numIndexes;
	std::string						shader;
	int								lightmap;
};

struct PixelShaderGroup
{
	std::vector<ShaderSurfaces>		surfaces;
};

struct Scene
{
	std::vector<PixelShaderGroup>	psGroups;
};



#endif
